# ***meta charset="UTF-8"***
# @Time: 2021/2/3 16:27
# @Author: 邢光强
# @Email： 1062584918@qq.com
# @File： clue_page.py
# @Project: crm_project

from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from pages.base_page import BasePage

class CluePage(BasePage):
    tj_locator = (By.XPATH,"/html/body/div[5]/div[1]/ul/li[3]/a")
    search_locator = (By.XPATH,"/html/body/div[5]/div[2]/div[1]/ul/li/form/ul/li[4]/button")
    tj_report_locator = (By.ID,"show_report")
    tj_source_locator = (By.ID,"show_source")
    department_select_locator = (By.ID,"department")
    role_select_locator = (By.ID,"role")
    tool_locator = (By.CLASS_NAME,"highcharts-button")
    tool_print_locator = (By.XPATH,"/html/body/div[5]/div[2]/div[3]/div[2]/div/div/div/div/div/div[1]")
    tool_download_locator = (By.XPATH,"/html/body/div[5]/div[2]/div[3]/div[2]/div/div/div/div/div/div[2]")
    tjbb_locator = (By.XPATH,"/html/body/div[5]/div[2]/div[3]/div[1]/table")


    def click_tj(self):
        self.find_element(self.tj_locator).click()

    def click_search(self):
        self.find_element(self.search_locator).click()

    def click_tj_report(self):
        self.find_element(self.tj_report_locator).click()

    def click_tj_source(self):
        self.find_element(self.tj_source_locator).click()

    def department_select(self):
        return Select(self.find_element(self.department_select_locator))

    def role_select(self):
        return Select(self.find_element(self.role_select_locator))

    def click_tool(self):
        self.find_element(self.tool_locator).click()

    def click_tool_print(self):
        return self.find_element(self.tool_print_locator).text

    def click_tool_download(self):
        self.find_element(self.tool_download_locator).click()

    def tool_download_text(self):
        return self.find_element(self.tool_download_locator).text

    def tjbb(self):
        return self.find_element(self.tjbb_locator).text


